const koa = require("koa");
const betterBody = require("koa-better-body");
const convert = require("koa-convert");
const pathlib = require("path");

let server = new koa();
server.listen(8080);

server.use(convert(betterBody({
	uploadDir:pathlib.resolve('./upload'),
	keepExtensions:true
})));

server.use(async (ctx,next)=>{
	console.log(ctx.request.fields);//数据+文件信息
	console.log(ctx.request.files);//文件信息全一些
	ctx.response.body="成功"
});

